<?php

namespace app\api\controller;

use app\common\controller\Api;

use app\api\controller\send;
use think\exception\Handle;
use think\Request;
use think\Response;
use think\exception\HttpResponseException;
use think\Db;
use think\Date;

class Vapi extends Api
{

    //如果$noNeedLogin为空表示所有接口都需要登录才能请求
    //如果$noNeedRight为空表示所有接口都需要验证权限才能请求
    //如果接口已经设置无需登录,那也就无需鉴权了
    //
    // 无需登录的接口,*表示全部
    protected $noNeedLogin = ['*'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];

    //http://fastaws.test/api/vapi/testB
    //http://lj.megotw.com/api/vapi/testB
    public function testB()
    {
        $data = [];
        $data[] = array(
            "value" => 35,
            "name" => "圆环1",
            "series" => "系列一",
        );
        $data[] = array(
            "value" => 10,
            "name" => "圆环2",
            "series" => "系列一",
        );
        $data[] = array(
            "value" => 5,
            "name" => "圆环3",
            "series" => "系列一",
        );
        $data[] = array(
            "value" => 30,
            "name" => "圆环4",
            "series" => "系列一",
        );

        $this->success2($data);
    }

    private function success2($result)
    {
        $response = Response::create($result, 'json', 200)->header([]);
        throw new HttpResponseException($response);
    }

}
